<html>
    <head>
        <title>TrackIR in WebGL</title>
        <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
        <script type="text/javascript" src="web_js/glMatrix-0.9.5.min.js"></script>
        <script type="text/javascript" src="web_js/trackirController.js"></script>
    </head>
    <body id="body" onload="webGLStart();">
    <div id="trackIRDLLoutput"></div>

    <script language="javascript">

    var trackIR = new trackIRController();
    var d = document.getElementById("trackIRDLLoutput");

    function printData() {
        var matData = "";
        var tmpData = "";
        matData = trackIR.tirGetMatrix();
        if(trackIR.tirIsCameraInitialized() == true) {
            matData[12] = 0;
            matData[13] = 0;
            matData[14] = 0;
            tmpData += matData[0] + ", " + matData[1] + ", " + matData[2] + ", " + matData[3] + "<br>\n";
            tmpData += matData[4] + ", " + matData[5] + ", " + matData[6] + ", " + matData[7] + "<br>\n";
            tmpData += matData[8] + ", " + matData[9] + ", " + matData[10] + ", " + matData[11] + "<br>\n";
            tmpData += matData[12] + ", " + matData[13] + ", " + matData[14] + ", " + matData[15] + "<br>\n";
            d.innerHTML = tmpData;
        }
        requestAnimFrame(printData);
    }

    function webGLStart() {
        printData();
    }

window.requestAnimFrame = (function() {
  return window.requestAnimationFrame ||
         window.webkitRequestAnimationFrame ||
         window.mozRequestAnimationFrame ||
         window.oRequestAnimationFrame ||
         window.msRequestAnimationFrame ||
         function(/* function FrameRequestCallback */ callback, /* DOMElement Element */ element) {
           window.setTimeout(callback, 1000/60);
         };
})();

  </script>

</body>
</html>
